<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Venta</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Venta</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../files/app/models/venta_rb.html">
                app/models/venta.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="Comunicacion.html">
                Comunicacion
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000034">get_form_html_id</a>&nbsp;&nbsp;
      <a href="#M000027">get_mod_venta</a>&nbsp;&nbsp;
      <a href="#M000035">get_name</a>&nbsp;&nbsp;
      <a href="#M000036">get_partial</a>&nbsp;&nbsp;
      <a href="#M000030">listas_contactos</a>&nbsp;&nbsp;
      <a href="#M000029">listas_trainees</a>&nbsp;&nbsp;
      <a href="#M000028">search_all</a>&nbsp;&nbsp;
      <a href="#M000033">search_contacto</a>&nbsp;&nbsp;
      <a href="#M000032">search_cuenta</a>&nbsp;&nbsp;
      <a href="#M000031">search_trainee</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000027" class="method-detail">
        <a name="M000027"></a>

        <div class="method-heading">
          <a href="#M000027" class="method-signature">
          <span class="method-name">get_mod_venta</span><span class="method-args">(user,venta)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000027-source">
<pre>
    <span class="ruby-comment cmt"># File app/models/venta.rb, line 7</span>
 7:         <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get_mod_venta</span>(<span class="ruby-identifier">user</span>,<span class="ruby-identifier">venta</span>)
 8:                 <span class="ruby-ivar">@asignados</span> = <span class="ruby-constant">UsuarioCuenta</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">:first</span>,<span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-value str">'user_id = ? and cuenta_id = ?'</span>,<span class="ruby-identifier">user</span>.<span class="ruby-identifier">id</span>,<span class="ruby-identifier">venta</span>.<span class="ruby-identifier">cuenta</span>.<span class="ruby-identifier">id</span>])
 9:                 <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@asignados</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">user</span>.<span class="ruby-identifier">role_user</span>.<span class="ruby-identifier">descripcion</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'Administrador'</span> <span class="ruby-keyword kw">then</span>
10:                         <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
11:                 <span class="ruby-keyword kw">else</span>
12:                <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> 
13:                 <span class="ruby-keyword kw">end</span>           
14:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000030" class="method-detail">
        <a name="M000030"></a>

        <div class="method-heading">
          <a href="#M000030" class="method-signature">
          <span class="method-name">listas_contactos</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000030-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000030-source">
<pre>
    <span class="ruby-comment cmt"># File app/models/venta.rb, line 27</span>
27:         <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">listas_contactos</span>()
28:                 <span class="ruby-ivar">@contactos_ids</span> = <span class="ruby-constant">Venta</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">:all</span>).<span class="ruby-identifier">collect</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">:contacto_id</span>)
29:           <span class="ruby-ivar">@contactos</span> = <span class="ruby-constant">Contacto</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">:all</span>, <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-value str">'id in (?)'</span>,<span class="ruby-ivar">@contactos_ids</span>])        
30:           <span class="ruby-ivar">@contactos</span> = <span class="ruby-ivar">@contactos</span>.<span class="ruby-identifier">uniq</span>
31:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000029" class="method-detail">
        <a name="M000029"></a>

        <div class="method-heading">
          <a href="#M000029" class="method-signature">
          <span class="method-name">listas_trainees</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000029-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000029-source">
<pre>
    <span class="ruby-comment cmt"># File app/models/venta.rb, line 21</span>
21:         <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">listas_trainees</span>()
22:                 <span class="ruby-ivar">@trainees_ids</span> = <span class="ruby-constant">Venta</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">:all</span>).<span class="ruby-identifier">collect</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">:producto_id</span>) 
23:           <span class="ruby-ivar">@trainees</span> = <span class="ruby-constant">Trainee</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">:all</span>, <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-value str">'id in (?)'</span>,<span class="ruby-ivar">@trainees_ids</span>]) 
24:           <span class="ruby-ivar">@trainees</span> = <span class="ruby-ivar">@trainees</span>.<span class="ruby-identifier">uniq</span>
25:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000028" class="method-detail">
        <a name="M000028"></a>

        <div class="method-heading">
          <a href="#M000028" class="method-signature">
          <span class="method-name">search_all</span><span class="method-args">(page)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000028-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000028-source">
<pre>
    <span class="ruby-comment cmt"># File app/models/venta.rb, line 17</span>
17:         <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">search_all</span>(<span class="ruby-identifier">page</span>)
18:                 <span class="ruby-identifier">paginate</span> <span class="ruby-identifier">:per_page</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">3</span>, <span class="ruby-identifier">:page</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">page</span>, <span class="ruby-identifier">:order</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'fecha DESC'</span>
19:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000033" class="method-detail">
        <a name="M000033"></a>

        <div class="method-heading">
          <a href="#M000033" class="method-signature">
          <span class="method-name">search_contacto</span><span class="method-args">(page, contacto_id)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000033-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000033-source">
<pre>
    <span class="ruby-comment cmt"># File app/models/venta.rb, line 41</span>
41:         <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">search_contacto</span>(<span class="ruby-identifier">page</span>, <span class="ruby-identifier">contacto_id</span>)
42:                 <span class="ruby-identifier">paginate</span> <span class="ruby-identifier">:per_page</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">3</span>, <span class="ruby-identifier">:page</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">page</span>, <span class="ruby-identifier">:order</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'id'</span>, <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-value str">'contacto_id = '</span><span class="ruby-operator">+</span><span class="ruby-identifier">contacto_id</span>]
43:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000032" class="method-detail">
        <a name="M000032"></a>

        <div class="method-heading">
          <a href="#M000032" class="method-signature">
          <span class="method-name">search_cuenta</span><span class="method-args">(page, cuenta_id)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000032-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000032-source">
<pre>
    <span class="ruby-comment cmt"># File app/models/venta.rb, line 37</span>
37:         <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">search_cuenta</span>(<span class="ruby-identifier">page</span>, <span class="ruby-identifier">cuenta_id</span>)
38:                 <span class="ruby-identifier">paginate</span> <span class="ruby-identifier">:per_page</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">3</span>, <span class="ruby-identifier">:page</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">page</span>, <span class="ruby-identifier">:order</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'id'</span>, <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-value str">'cuenta_id = '</span><span class="ruby-operator">+</span><span class="ruby-identifier">cuenta_id</span>]
39:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000031" class="method-detail">
        <a name="M000031"></a>

        <div class="method-heading">
          <a href="#M000031" class="method-signature">
          <span class="method-name">search_trainee</span><span class="method-args">(page, trainee_id)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000031-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000031-source">
<pre>
    <span class="ruby-comment cmt"># File app/models/venta.rb, line 33</span>
33:         <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">search_trainee</span>(<span class="ruby-identifier">page</span>, <span class="ruby-identifier">trainee_id</span>)
34:                 <span class="ruby-identifier">paginate</span> <span class="ruby-identifier">:per_page</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">3</span>, <span class="ruby-identifier">:page</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">page</span>, <span class="ruby-identifier">:order</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'id'</span>, <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-value str">'producto_id = '</span><span class="ruby-operator">+</span><span class="ruby-identifier">trainee_id</span>]
35:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000034" class="method-detail">
        <a name="M000034"></a>

        <div class="method-heading">
          <a href="#M000034" class="method-signature">
          <span class="method-name">get_form_html_id</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000034-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000034-source">
<pre>
    <span class="ruby-comment cmt"># File app/models/venta.rb, line 45</span>
45:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_form_html_id</span> 
46:                 <span class="ruby-value str">'ven_form'</span>
47:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000035" class="method-detail">
        <a name="M000035"></a>

        <div class="method-heading">
          <a href="#M000035" class="method-signature">
          <span class="method-name">get_name</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000035-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000035-source">
<pre>
    <span class="ruby-comment cmt"># File app/models/venta.rb, line 49</span>
49:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_name</span> 
50:                 <span class="ruby-value str">'Venta'</span>
51:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000036" class="method-detail">
        <a name="M000036"></a>

        <div class="method-heading">
          <a href="#M000036" class="method-signature">
          <span class="method-name">get_partial</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000036-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000036-source">
<pre>
    <span class="ruby-comment cmt"># File app/models/venta.rb, line 53</span>
53:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_partial</span>
54:                 <span class="ruby-value str">'comunicaciones/forms/form_ven'</span>
55:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>